package com.neuedu.service.impl;

import java.util.List;
import java.util.Map;

import org.mybatis.spring.SqlSessionTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.neuedu.dao.PurchasingDao;
import com.neuedu.model.Purchasing;
import com.neuedu.service.PurchasingService;

@Service
public class PurchasingServiceImpl implements PurchasingService {

	@Autowired
	private SqlSessionTemplate sqlSessionTemplate;
	
	public void setSqlSessionTemplate(SqlSessionTemplate sqlSessionTemplate) {
		this.sqlSessionTemplate = sqlSessionTemplate;
	}

	@Override
	public int countPurchasing() {
		// TODO Auto-generated method stub
		return sqlSessionTemplate.getMapper(PurchasingDao.class).countPurchasing();
	}

	@Override
	public List<Purchasing> findAll(Map<String, Object> map) {
		// TODO Auto-generated method stub
		return sqlSessionTemplate.getMapper(PurchasingDao.class).findAll(map);
	}

	@Override
	public int addPurchasing(Purchasing u) {
		// TODO Auto-generated method stub
		return sqlSessionTemplate.getMapper(PurchasingDao.class).addPurchasing(u);
	}

	@Override
	public int updatePurchasing(Purchasing u) {
		// TODO Auto-generated method stub
		return sqlSessionTemplate.getMapper(PurchasingDao.class).updatePurchasing(u);
	}

	@Override
	public int deletePurchasing(int id) {
		// TODO Auto-generated method stub
		return sqlSessionTemplate.getMapper(PurchasingDao.class).deletePurchasing(id);
	}

}
